<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="referrer" content="never">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>工作台</title>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <script src="../common/cs_work_header.js"></script>
    <!-- 侧边菜单 -->
    <div class="layui-side layui-side-menu" style="height:100%;">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" id="LAY_wechat_nav" lay-filter="wechat-list" style="height:100%;">
                <li class="layui-nav-item layui-nav-itemed" style="height:100%;">
                    <a class="" href="javascript:;"><i
                            class="layui-icon layui-icon-login-wechat"></i><cite>微信</cite></a>
                    <dl class="layui-nav-child" style="height:400px;overflow: hidden;overflow-y:auto; "
                        id="LAY_wechat_list"></dl>
                </li>
            </ul>
        </div>
    </div>
    <!-- 内容主体区域 -->
    <div id="LAY_app_body" class="layui-body">
        <div class="layui-fluid" style="padding: 0;">
            <div class="layui-row">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-tab layui-tab-card LAY-chat-tab" id="wechat_tab_wrap" lay-filter="wechat"
                             lay-allowclose="true">
                            <ul class="layui-tab-title">
                            </ul>
                            <div class="layui-tab-content" id="LAY_wechat_content" style="display: block;padding: 0;">
                            </div>
                        </div>
                        <!-- 辅助元素，一般用于移动设备下遮罩 -->
                        <div class="layadmin-body-shade" layadmin-event="shade"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script id="tpl_wechat_board" type="text/html">
        <div class="layui-row layui-fluid" style="height:100%;padding: 0;" id="board{{ d.boardId }}">
            <div class="wechat_board_right"
                 style="background: #f9f9f9;height:100%;border-style: solid;border-width: 1px;border-color:#dddddd;">
                <div class="wechat_board_right_friends" style="height:100%;display: none;">
                    <div class="wechat_board_right_friend_list"
                         style="width:300px;float:left;background: #f9f9f9;height:100%;border-style: solid;border-width: 1px;border-color:#dddddd;overflow: hidden;">
                        <div class="layui-col-sm12 layui-col-space2"
                             style="padding: 5px;background: #393D49;border-width: 1px;border-color:#dddddd;overflow: hidden;">
                            <div class="layui-input-inline">
                                <span style="text-align:center;cursor: pointer;padding:0 25px;"
                                      onclick="showChatWindow('board{{ d.boardId }}', {{ d.boardId }}, 1)"><i
                                        class="layui-icon layui-icon-dialogue board_swich_chat"
                                        style="font-size:35px; color:#5FB878;"></i></span>
                                <span style="text-align:center;cursor: pointer;padding:0 25px;"
                                      onclick="showFriends('board{{ d.boardId }}', {{ d.boardId }});"><i
                                        class="layui-icon layui-icon-friends board_swich_friend"
                                        style="font-size:35px; color:#c2c2c2;"></i></span>
                                <span style="text-align:center;cursor: pointer;padding:0 25px;"
                                      onclick="showAddFriend({{ d.boardId }});"><i
                                        class="layui-icon layui-icon-add-1 board_add_friend"
                                        style="font-size:35px; color:#c2c2c2;"></i></span>
                            </div>
                        </div>
                        <div class="layui-col-sm12 layui-col-space2" style="padding: 5px;">
                            <div class="layui-input-inline">
                                <div class="layui-input-inline">
                                    <input type="text" name="search_friend" id="search_friend" placeholder="搜索"
                                           autocomplete="off" class="layui-input"
                                           onblur="getFriends({{ d.boardId }}, true);" style="width:240px;">
                                </div>
                                <div class="layui-input-inline">
                                    <button class="layui-btn layui-btn-sm" onclick="getFriends({{ d.boardId }}, true);">
                                        搜索
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-sm12 layui-collapse" style="overflow: hidden;" lay-accordion>
                            <div class="layui-colla-item">
                                <h2 class="layui-colla-title stranger_tab">新朋友</h2>
                                <div class="layui-colla-content">
                                    <div class="layui-col-sm12 wechat_stranger_list"
                                         style="overflow: hidden;overflow-y:auto; ">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-colla-item">
                                <h2 class="layui-colla-title">联系人</h2>
                                <div class="layui-colla-content layui-show">
                                    <div class="layui-col-sm12 wechat_friend_list"
                                         id="wechat_friend_list_{{ d.boardId }}"
                                         style="overflow: hidden;overflow-y:auto; ">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="wechat_board_right_friend_info"
                         style="border-style: solid;border-width: 1px;border-right-color: #dddddd;border-left-color: #f9f9f9;border-bottom-color: #dddddd;border-top-color:#dddddd;height:100%;background: #f9f9f9;overflow: hidden;overflow-y:auto;">
                        <div class="layui-row layim-friend-info" style="height:100%;">
                            <i class="layui-icon layui-icon-login-wechat"
                               style="font-size:60px; color:#f2f2f2;position: relative;top:50%;left:50%;"></i>
                        </div>
                    </div>
                </div>

                <div class="wechat_board_right_chat" style="height:100%;">
                    <div class="wechat_board_right_chat_friend"
                         style="width:300px;float:left;background: #f9f9f9;height:100%;border-style: solid;border-width: 1px;border-color:#dddddd;">
                        <div class="layui-col-sm12 layui-col-space2"
                             style="padding: 5px;background: #393D49;border-width: 1px;border-color:#dddddd;">
                            <div class="layui-input-inline">
                                <span style="text-align:center;cursor: pointer;padding:0 25px;"
                                      onclick="showChatWindow('board{{ d.boardId }}', {{ d.boardId }}, 1)"><i
                                        class="layui-icon layui-icon-dialogue board_swich_chat"
                                        style="font-size:35px; color:#5FB878;"></i></span>
                                <span style="text-align:center;cursor: pointer;padding:0 25px;"
                                      onclick="showFriends('board{{ d.boardId }}', {{ d.boardId }});"><i
                                        class="layui-icon layui-icon-friends board_swich_friend"
                                        style="font-size:35px; color:#c2c2c2;"></i></span>
                                <span style="text-align:center;cursor: pointer;padding:0 25px;"
                                      onclick="showAddFriend({{ d.boardId }});"><i
                                        class="layui-icon layui-icon-add-1 board_add_friend"
                                        style="font-size:35px; color:#c2c2c2;"></i></span>
                            </div>
                        </div>
                        <!--<div class="layui-col-sm12 layui-col-space2" style="padding: 5px;">-->
                            <!--<div class="layui-input-inline">-->
                                <!--<div class="layui-input-inline">-->
                                    <!--<input type="text" name="search_chat" placeholder="搜索" autocomplete="off"-->
                                           <!--class="layui-input" onchange="getChats({{ d.boardId }}, 1);"-->
                                           <!--style="width:240px;">-->
                                <!--</div>-->
                                <!--<div class="layui-input-inline">-->
                                    <!--<button class="layui-btn layui-btn-sm" onclick="getChats({{ d.boardId }}, 1);">搜索-->
                                    <!--</button>-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                        <div class="layui-col-sm12 wechat_chat_list" id="wechat_chat_list{{ d.boardId }}"
                             style="overflow: hidden;overflow-y:auto; ">
                        </div>
                    </div>
                    <div class="wechat_board_right_more_window"
                         style="width:300px;height:100%;float:right;border-style: solid;border-width: 1px;border-right-color: #dddddd;border-left-color: #f9f9f9;border-bottom-color: #dddddd;border-top-color:#dddddd;background: #fff;overflow: hidden;display: none;">
                        <div class="layui-tab">
                            <ul class="layui-tab-title">
                                <li class="layui-this">客户资料</li>
                                <li id="snsTab_{{ d.boardId }}" name="snsTab" friend_id=""
                                    onclick="showSnsTabContent({{ d.boardId }});">朋友圈
                                </li>
                                <li id="materialTab_{{ d.boardId }}" name="materialTab" friend_id=""
                                    onclick="showMaterialTabContent({{ d.boardId }});">快捷回复
                                </li>
                            </ul>
                            <div class="layui-tab-content">
                                <div class="layui-tab-item layui-show">
                                    <div id="customer_info_panel_{{ d.boardId }}" class="customer_info_panel"
                                         style="overflow: hidden;overflow-y:auto;">
                                        <div class="layui-row">
                                            <fieldset class="layui-elem-field layui-field-title">
                                                <legend>客户资料</legend>
                                                <div class="layui-field-box layim-customer-info">

                                                </div>
                                            </fieldset>
                                        </div>
                                        <div class="layui-row">
                                            <fieldset class="layui-elem-field layui-field-title">
                                                <legend>标签</legend>
                                                <div class="layui-field-box layim-friend-tag">

                                                </div>
                                            </fieldset>
                                        </div>
                                    </div>
                                </div>
                                <div class="layui-tab-item">
                                    <div id="friend_sns_page_panel_{{ d.boardId }}" class="friend_sns_page_panel"
                                         style="overflow: hidden;overflow-y:auto;">
                                        <div id="friend_sns_page_{{ d.boardId }}"></div>
                                    </div>
                                </div>
                                <div class="layui-tab-item">
                                    <div id="quick_reply_groups_{{ d.boardId }}"></div>
                                    <hr>
                                    <div id="quick_reply_panel_{{ d.boardId }}" class="quick_reply_panel"
                                         style="overflow: hidden;overflow-y:auto;">
                                        <div id="quick_reply_{{ d.boardId }}"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="wechat_board_right_chat_window"
                         style="border-style: solid;border-width: 1px;border-right-color: #dddddd;border-left-color: #f9f9f9;border-bottom-color: #dddddd;border-top-color:#dddddd;height:100%;background: #f9f9f9;overflow: hidden;overflow-y:auto;">
                        <div class="layui-col-sm12" style="height:100%;display: none;">
                            <i class="layui-icon layui-icon-login-wechat"
                               style="font-size:60px; color:#f2f2f2;position: relative;top:50%;left:50%;"></i>
                        </div>

                        <div class="layui-row layim-chat-box" style="height:100%;">
                            <i class="layui-icon layui-icon-login-wechat"
                               style="font-size:60px; color:#f2f2f2;position: relative;top:50%;left:50%;"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </script>
    <script id="tpl_chat_list" type="text/html">
        {{#  if(d.list.length>0){ }}
        {{#  layui.each(d.list, function(index, item){ }}
        <div class="layui-row layui-col-space5" style="margin:1px;background: #ffffff;" id="friend{{ item.friend_id }}"
             onclick="showChatRecords({{ item.wechat_id }}, {{ item.friend_id }}, '{{ item.friend_name }}', {{ item.friend_type }})">
            <div class="layui-col-sm3">
                {{# if(item.friend_small_head_image){ }}
                <img src="{{ item.friend_small_head_image }}" style="width: 100%; height: 100%;">
                {{# } else { }}
                <img src="../assets/images/default_head.jpeg" style="width: 100%; height: 100%;">
                {{# } }}
            </div>
            <div class="layui-col-sm9" style="height: 100%;">
                <span style="float: left;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ item.friend_name || item.friend_username }}</span>
                <span style="position: relative;float: right;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ item.send_date.replace(/-/g, '/').substr(2, 8) }}</span>
                <span class="layui-form-mid layui-word-aux"
                      style="width:90%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ item.content || '' }}</span>
            </div>
            <span class="layui-badge" style="display:none;position: absolute;top:0;right:0;z-index:999999;"></span>
        </div>
        {{#  }); }}
        {{#  } else { }}
        <div class="layui-row layui-col-space10" style="margin:1px;background: #ffffff;">
            <div class="layui-col-sm12">
                <span>无匹配记录</span>
            </div>
        </div>
        {{#  } }}
    </script>
    <script id="tpl_friend_list" type="text/html">
        {{#  if(d.list.length>0){ }}
        {{#  layui.each(d.list, function(index, item){ }}
        <div class="layui-row layui-col-space5" style="margin:1px;background: #f9f9f9;" id="{{ item.id }}"
             onclick="getFriendInfo({{ d.wechat_id }}, {{ item.id }})">
            <div class="layui-col-sm3">
                <img src="{{ item.small_head_image || '../assets/images/default_head.jpeg' }}"
                     style="width: 100%; height: 100%;">
            </div>
            <div class="layui-col-sm9">
                <span>{{ item.remark || (item.name || item.username) }}</span>
            </div>
        </div>
        {{#  }); }}
        {{#  } else { }}
        <div class="layui-row layui-col-space10" style="margin:1px;background: #ffffff;">
            <div class="layui-col-sm12">
                <span>无匹配记录</span>
            </div>
        </div>
        {{#  } }}
    </script>
    <script id="tpl_chat_records" type="text/html">
        <div class="layim-chat layim-chat-friend layui-show" id="friendChat_{{ d.wechat_id }}_{{ d.friend_id }}"
             onclick="showDot(false, '{{ d.wechat_id }}', '{{ d.friend_id }}')">
            <div style="height:15px;padding:10px;">
                <span>{{ d.friend_name }}</span>
            </div>
            <hr class="layui-bg-gray">
            <!--style="height: 200px;padding: 15px 15px 5px;overflow: hidden;"-->
            <div class="layim-chat-main" name="LAY_wechat_msg"
                 id="friendChatRecord_{{ d.wechat_id }}_{{ d.friend_id }}">
                <div class="layui-flow-more">
                    <a class="load-more-message" href="javascript:;"
                       onclick="getChatRecord({{d.board_id}},'{{ d.wechat_id }}', '{{ d.friend_id }}', true);"><cite>加载更多</cite></a>
                    <span class="loading-more-message" style="display: none;"><i
                            class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"
                            style="padding:0;font-size:30px;"></i></span>
                </div>
                <ul>
                </ul>
            </div>
            <div>
                <hr class="layui-bg-gray" style="margin: 0;">
                <div class="layui-unselect layim-chat-tool">
                    <label for="sendImg_{{ d.wechat_id }}_{{ d.friend_id }}"> <input type="file" style="display: none"
                                                                                     id="sendImg_{{ d.wechat_id }}_{{ d.friend_id }}"><span
                            class="sendImg" title="图片"><i class="layui-icon layui-icon-picture"
                                                          style="font-size: 25px;color: #666;"></i></span></label>
                </div>
                <textarea placeholder="" class="layui-textarea new-chat-message" rows="8"></textarea>
                <div style="float: right;">
                    <button class="layui-btn" onclick="sendMsg({{d.board_id}},'{{d.wechat_id}}', '{{d.friend_id}}')">
                        回车发送
                    </button>
                </div>
            </div>
        </div>
    </script>
    <!--<script id="tpl_msg" type="text/html">-->
    <!--<li {{ d.msg.MsgType==1 || 'class="layim-chat-mine"' }} id="record_{{ d.msg.record_id }}">-->
    <!--<div class="layim-chat-user">-->
    <!--{{# if(d.msg.MsgType==1){ }}-->
    <!--<img src="{{ d.msg.toavatar || '../assets/images/default_head.jpeg' }}">-->
    <!--<cite>-->
    <!--{{ d.msg.toname }}-->
    <!--<i>{{ d.msg.time }}</i>-->
    <!--</cite>-->
    <!--{{# } else { }}-->
    <!--<img src="{{ d.msg.fromavatar || '../assets/images/default_head.jpeg' }}">-->
    <!--<cite>-->
    <!--{{# if(d.msg.status==1 || d.msg.status==2){ }}-->
    <!--<i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"-->
    <!--style="padding:0;"></i>-->
    <!--{{# } else if(d.msg.status==-1) { }}-->
    <!--{{# } }}-->
    <!--<i class="msg_remark">-->
    <!--{{# if(d.msg.status==-1 && d.msg.remark!=''){ }}-->
    <!--<i class="layui-icon layui-icon-tips" style="padding:0;color:red;"><label>{{ d.msg.remark }}</label></i>-->
    <!--{{# } }}-->
    <!--</i>-->
    <!--<i>{{ d.msg.time }}</i>-->
    <!--{{ d.msg.fromname }}-->
    <!--</cite>-->
    <!--{{# } }}-->
    <!--</div>-->
    <!--<div class="layim-chat-text">-->
    <!--{{# if(d.msg.MsgType==1){ }}-->
    <!--{{ parseEmotion(d.msg.content) }}-->
    <!--{{# } else if(d.msg.MsgType==2) { }}-->
    <!--<div class="layui-unselect layui-layim-audio" layim-event="playAudio"-->
    <!--data-src="/cs_work/getVoiceFile/{{ d.msg.wechat_id }}/{{ d.msg.record_id }}/{{ d.msg.material_id }}"><i-->
    <!--class="layui-icon layui-icon-voice"></i></div>-->
    <!--{{# } else if(d.msg.MsgTypeMsgType==3) { }}-->
    <!--{{# if (d.msg.mediaUrl2) { }}-->
    <!--<img id="chatImg{{ d.msg.record_id }}" midimg="0" src="{{ d.msg.mediaUrl2 }}&type=MIDIMG"-->
    <!--onclick="getMediaV2({{ d.msg.record_id }}, '{{ d.msg.mediaUrl2 }}&type={{ d.msg.bigImg }}', 'HDIMG');"-->
    <!--style="cursor: pointer;width: 200px;">-->
    <!--{{# } else { }}-->
    <!--<img id="chatImg{{ d.msg.record_id }}" midimg="0" src="data:image/png;base64,{{ d.msg.content }}"-->
    <!--style="width: 250px;">-->
    <!--{{# } }}-->
    <!--{{# } else if(d.msg.MsgType==4) { }}-->
    <!--&lt;!&ndash;            <span style="cursor: pointer;" onclick="getMedia({{ d.msg.wechat_id }}, {{ d.msg.record_id }}, 'FILE');">&ndash;&gt;-->
    <!--<span style="cursor: pointer;"-->
    <!--onclick="getMediaV2({{ d.msg.record_id }}, '{{ d.msg.mediaUrl2 }}&type=FILE&fileName={{ d.msg.content }}', 'FILE');">-->
    <!--{{ d.msg.content }}-->
    <!--{{#  if(d.msg.fileType){ }}-->
    <!--<img src="/assets/images/{{ d.msg.fileType }}.png" style="width: 30px;">-->
    <!--{{#  } else { }}-->
    <!--<i class="layui-icon layui-icon-file" style="font-size: 30px;color:green;"></i>-->
    <!--{{#  } }}-->
    <!--</span>-->
    <!--{{# } else if(d.msg.msg_type==5) { }}-->
    <!--<div style="cursor: pointer;position: relative; width: 100px"-->
    <!--onclick="getMediaV2({{ d.msg.record_id }}, '{{ d.msg.mediaUrl2 }}&type=VIDEO', 'VIDEO');"-->
    <!--style="display: block;">-->
    <!--&lt;!&ndash;                <img id="chatImg{{ d.msg.record_id }}" midimg="0" src="/assets/images/spacer.gif" onload="getMedia({{ d.msg.wechat_id }}, {{ d.msg.record_id }}, 'THUMB', {{ d.msg.record_id }});">&ndash;&gt;-->
    <!--<img id="chatImg{{ d.msg.record_id }}" midimg="0" src="{{ d.msg.mediaUrl2 }}&type=THUMB">-->
    <!--<i class="layui-icon layui-icon-play"-->
    <!--style="position: absolute; top: 35%; left: 35%;z-index:2;font-size: 30px;color: #fff;"></i>-->
    <!--</div>-->
    <!--{{# } else if(d.msg.msg_type==6) { }}-->
    <!--{{# if(d.msg.sns_media_id){ }}-->
    <!--&lt;!&ndash;                <img id="snsImg{{ d.msg.snsMediaFileId }}_{{ d.msg.record_id }}" src="/assets/images/spacer.gif" snsImg="0" onload="getSnsMedia({{ d.msg.wechat_id }}, {{ d.msg.friend_id }}, '{{ d.msg.snsMediaFileId }}', 'THUMB', {{ d.msg.record_id }});">&ndash;&gt;-->
    <!--<img id="snsImg{{ d.msg.snsMediaFileId }}_{{ d.msg.record_id }}" src="{{ d.msg.mediaUrl2 }}" snsImg="0">-->
    <!--{{# } else { }}-->
    <!--<img id="chatImg{{ d.msg.record_id }}" src="{{ d.msg.content }}">-->
    <!--{{# } }}-->
    <!--{{# } }}-->
    <!--</div>-->
    <!--</li>-->
    <!--</script>-->
    <script id="tpl_msg" type="text/html">
        <li {{ d.msg.isRecipient || 'class="layim-chat-mine"' }} id="record_{{ d.msg.id }}">
        <div class="layim-chat-user">
            <img src="{{ d.msg.fromavatar || '../assets/images/default_head.jpeg' }}">
            <cite>
                {{# if(d.msg.status==1 || d.msg.status==2){ }}
                <i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"
                   style="padding:0;"></i>
                {{# } else if(d.msg.status==-1) { }}
                {{# } }}
                <i class="msg_remark">
                    {{# if(d.msg.status==-1 && d.msg.remark!=''){ }}
                    <i class="layui-icon layui-icon-tips" style="padding:0;color:red;"><label>{{ d.msg.remark }}</label></i>
                    {{# } }}
                </i>
                <i>{{ parseTime(d.msg.CreateTime) }}</i>
                {{ d.msg.fromname }}
            </cite>
        </div>
        {{# if(d.msg.MsgType==1){ }}
        <div class="layim-chat-text">
            {{ d.msg.Content }}
        </div>
        {{# } }}
        {{# if(d.msg.MsgType==47){ }}
        {{parseEmoji(d.msg.Content,d.msg.isRecipient)}}
        {{# } }}
        </li>
    </script>
    <script id="tpl_friend_info" type="text/html">
        <div class="layim-chat layui-show" id="friendInfo_{{ d.wechat_id }}_{{ d.friend_id }}">
            <div class="layui-row" style="padding: 20px;">
                <div class="layui-col-md1">&nbsp;</div>
                <div class="layui-col-md10">
                    <div class="layui-row">
                        <div class="layui-col-md8">
                            <div style="font-size: large;">
                                {{ d.friendInfo.nickName || '' }}&nbsp;&nbsp;
                                {{# if(d.friendInfo.sex=='1'){ }}
                                <i class="layui-icon layui-icon-male"
                                   style="font-size: 20px; color: cornflowerblue;"></i>
                                {{# } else { }}
                                <i class="layui-icon layui-icon-female" style="font-size: 20px; color: pink;"></i>
                                {{# } }}
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <img src="{{ d.friendInfo.avatar || '../assets/images/default_head.jpeg' }}" width="132px"
                                 height="132px">
                        </div>
                    </div>
                    <hr class="layui-bg-gray">
                    <div class="layui-row">
                        <div class="layui-row layui-form-label-col"><span class="layui-word-aux">备注名</span>&nbsp;&nbsp;&nbsp;&nbsp;{{
                            d.friendInfo.remark || '' }}
                        </div>
                        <div class="layui-row layui-form-label-col"><span
                                class="layui-word-aux">地&nbsp;&nbsp;&nbsp;区</span>&nbsp;&nbsp;&nbsp;&nbsp;{{
                            d.friendInfo.province }}&nbsp;{{ d.friendInfo.city }}
                        </div>
                        <div class="layui-row layui-form-label-col"><span class="layui-word-aux">微信号</span>&nbsp;&nbsp;&nbsp;&nbsp;{{
                            d.friendInfo.friendId }}
                        </div>
                        <div class="layui-row layui-form-label-col"></div>
                        <div class="layui-row layui-form-label-col"></div>
                    </div>
                    <div class="layui-row" style="text-align: center;">
                        <div>
                            <button class="layui-btn"
                                    onclick="sendMsgToFriend({{ d.friendInfo.boardId }},'{{ d.wechat_id }}','{{ d.friend_id }}', '{{ d.friendInfo.remark||d.friendInfo.nickName }}')">
                                发消息
                            </button>
                            <button class="layui-btn layui-btn-danger"
                                    onclick="deleteFriend({{d.friendInfo.id}}, '{{ d.friendInfo.remark||d.friendInfo.nickName }}')">
                                删除好友
                            </button>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md1">&nbsp;</div>
            </div>
        </div>
    </script>
    <script id="tpl_stranger_list" type="text/html">
        {{#  layui.each(d.list, function(index, item){ }}
        <div class="layui-row layui-col-space5" style="margin:1px;background: #f9f9f9;" id="stranger{{ item.id }}"
             onclick="getStrangerInfo({{ d.wechat_id }}, {{ item.id }})">
            <div class="layui-col-sm3">
                <img src="{{ item.head_img || '' }}" style="width: 100%; height: 100%;">
            </div>
            <div class="layui-col-sm9" style="height: 100%;">
                <span style="float: left;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ item.from_nickname || item.from_username }}</span><br>
                <span class="layui-word-aux"
                      style="width:90%;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{ item.content }}</span>
            </div>
            {{# if(item.is_read==0){ }}
            <span class="layui-badge-dot" style="position: absolute;right:1px;z-index: 999999;"></span>
            {{# showStrangerTabDot(true, d.wechat_id); }}
            {{# } }}
        </div>
        {{#  }); }}
    </script>
    <script id="tpl_stranger_info" type="text/html">
        <div class="layim-chat layui-show" id="strangerInfo_{{ d.wechat_id }}_{{ d.id }}">
            <div class="layui-row" style="padding: 20px;">
                <div class="layui-col-md1">&nbsp;</div>
                <div class="layui-col-md10">
                    <div class="layui-row">
                        <div class="layui-col-md8">
                            <div style="font-size: large;">
                                {{ d.strangerInfo.from_nickname }}
                            </div>
                        </div>
                        <div class="layui-col-md4">
                            <img src="{{ d.strangerInfo.head_img || '../assets/images/default_head.jpeg' }}"
                                 width="100px;">
                        </div>
                    </div>
                    <hr class="layui-bg-gray">
                    <div class="layui-row">
                        <div class="layui-row layui-form-label-col"><span
                                class="layui-word-aux">地&nbsp;&nbsp;&nbsp;区</span>&nbsp;&nbsp;&nbsp;&nbsp;{{
                            d.strangerInfo.province }}&nbsp;{{ d.strangerInfo.city }}
                        </div>
                        <div class="layui-row layui-form-label-col"><span class="layui-word-aux">微信号</span>&nbsp;&nbsp;&nbsp;&nbsp;{{
                            d.strangerInfo.from_username }}
                        </div>
                        <div class="layui-row layui-form-label-col"></div>
                    </div>
                    <hr class="layui-bg-gray">
                    <div class="layui-row">
                        <div class="layui-row layui-form-label-col">
                            <div class="layui-form-item">
                                <label class="layui-word-aux" style="float: left;position: relative;">打招呼</label>
                                <div style="margin-left: 70px;">
                                    {{# layui.each(d.strangerInfo.chatRecords, function(index, item){ }}
                                    {{# if(item.sender==1){ }}
                                    <p>{{ d.strangerInfo.from_nickname }}：{{ item.content }}</p>
                                    {{# } else { }}
                                    <p>我：{{ item.content }}</p>
                                    {{# } }}
                                    {{# }); }}
                                </div>
                            </div>
                        </div>
                        <div class="layui-row layui-form-label-col"></div>
                    </div>
                    <div class="layui-row" style="text-align: center;">
                        <div>
                            {{# if(d.strangerInfo.add_friend_status==0){ }}
                            {{# if(d.strangerInfo.opcode==2){ }}
                            <button class="layui-btn" onclick="acceptStranger({{ d.strangerInfo.id }})">通过验证</button>
                            {{# } else { }}
                            {{# } }}
                            <button class="layui-btn layui-btn-warm"
                                    onclick="replyStranger({{ d.wechat_id }}, {{ d.strangerInfo.id }})">回复
                            </button>
                            {{# } else { }}
                            <button class="layui-btn layui-btn-disabled">已添加</button>
                            {{# } }}
                        </div>
                    </div>
                </div>
                <div class="layui-col-md1">&nbsp;</div>
            </div>
        </div>
    </script>
    <script id="tpl_reply_stranger" type="text/html">
        <div class="layui-form-item layui-form-text">
            <input type="hidden" name="stranger_id" value="{{ d.stranger_id }}">
            <div style="padding: 20px;">
                <textarea name="reply_stranger" placeholder="请输入回复内容，不超过50个中文，100个字符" class="layui-textarea"></textarea>
            </div>
        </div>
    </script>
    <script id="tpl_add_friend" type="text/html">
        <div class="layui-form-item layui-form-text">
            <input type="hidden" name="wechat_id" value="{{ d.wechat_id }}">
            <div style="padding: 20px;">
                <input type="text" name="search_stranger" placeholder="请输入手机号、微信号或QQ号" required autocomplete="off"
                       class="layui-input"><br>
                <textarea name="friend_msg" placeholder="请输入验证消息，不超过50个中文，100个字符" class="layui-textarea"></textarea>
            </div>
        </div>
    </script>
    <script id="tpl_customer_info" type="text/html">
        {{#  layui.each(d.customerInfo, function(index, item){ }}
        {{#  if(item){ }}
        <div>{{ index }}：{{ item }}</div>
        {{#  } }}
        {{#  }); }}
    </script>
    <script type="text/html" id="wxidTpl">
        <img src="{{d.headImg || '../assets/images/default_head.jpeg'}}" width="30px">
        {{d.nickName}}
    </script>
    <script type="text/html" id="tagFriendBar">
        <button class="layui-btn layui-btn-sm layui-btn-normal"
                onclick="sendMsgToFriend({{ d.wechat_id }}, {{ d.id }}, '{{ d.name }}')">发消息
        </button>
    </script>
    <script id="tpl_material_group" type="text/html">
        <label>素材组筛选：</label>
        <span class="layui-breadcrumb" lay-separator="|">
    {{#  layui.each(d.materialGroups, function(index, item){ }}
    {{#  if(item){ }}
    <a href="#" onclick="getMaterials({{ d.wechat_id }}, {{ d.friend_id }}, {{ item.id }});">{{ item.name }}（{{ item.item_num }}）</a>
    {{#  } }}
    {{#  }); }}
    </span>
    </script>
    <script id="tpl_material" type="text/html">
        <table class="layui-table">
            <colgroup>
                <col>
                <col width="40">
            </colgroup>
            <tbody>
            {{# layui.each(d.materials, function(index, item){ }}
            {{# if(item){ }}
            <tr>
                <td>{{ item.title }}</td>
                <td>
                    <button class="layui-btn  layui-btn-xs"
                            onclick="sendMaterial({{ d.wechat_id }}, {{ d.friend_id }}, {{ item.id }})">发送
                    </button>
                </td>
            </tr>
            {{# } }}
            {{# }); }}
            </tbody>
        </table>
    </script>
    <script type="text/javascript" src="http://www.jsons.cn/Down/jquery.xml2json.js"></script>
    <script type="text/javascript" src="../assets/js/emoji.js"></script>
    <script type="text/javascript" src="../assets/js/cs_work.js"></script>
</div>
</body>
</html>
